package com.baidu.serviceimpl;

import com.baidu.mapper.GoodsMapper;
import com.baidu.pojo.GoodsBean;
import com.baidu.pojo.PicBean;
import com.baidu.service.GoodsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 创作时间：2019/10/25 11:29
 * 作者：李增强
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Resource
    private GoodsMapper goodsMapper;

    @Override
    public List<GoodsBean> getGoodsList() {
        return goodsMapper.getGoodsList();
    }

    @Override
    public void updateGoodsStatus(Integer gid) {
        Integer gstatus = goodsMapper.getGoodsStatus(gid);
        goodsMapper.updateGoodsStatus(gid,gstatus==0?-1:0);
    }

    @Override
    public List<GoodsBean> getGoodsListByGstatus(Integer gstatus) {
        return goodsMapper.getGoodsListByGstatus(gstatus);
    }

    @Override
    public List<PicBean> getGoodsPicList(Integer gid) {
        return goodsMapper.getGoodsPicList(gid);
    }

    @Override
    public void deletePicByPid(Integer pid) {
        goodsMapper.deletePicByPid(pid);
    }

    @Override
    public PicBean getPicBeanByPid(Integer pid) {
        return goodsMapper.getPicBeanByPid(pid);
    }

    @Override
    public void savePic(Integer gid, String purl) {
        goodsMapper.savePic(gid,purl);
    }
}
